﻿using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Lightworks.Core.Service
{
    /// <summary>
    /// 自動註冊service
    /// </summary>
    [AttributeUsage(AttributeTargets.Class)]
    public class ServiceAttribute : Attribute
    {
        public ServiceLifetime Lifetime { get; set; }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="serviceLifetime">默認Scoped tranient 每次請求創建實例；Scoped: 一次回話一個實例； Singleton 單例</param>
        public ServiceAttribute(ServiceLifetime serviceLifetime = ServiceLifetime.Scoped)
        {
            Lifetime = serviceLifetime;
        }
    }
}

